<template>
	<view>
		<pageIndex :myInfo="showList" :banner="require('@/static/image/prevention/banner.png')" :img="img"></pageIndex>
	</view>
</template>

<script>
	import {
		navList
	} from '@/mock/index/prevention.js';
	import pageIndex from '@/components/pageIndex.vue'
	import {
		Index
	} from '@/api/index.js';
	import {
			mapState
		} from 'vuex';
	export default {
		components: {
			pageIndex
		},
		data() {
			return {
				navList,
				img: '',
				showList:[],

			};
		},
		computed: {
					...mapState(['userInfo'])
				},
		methods: {
			async init() {
				const res = await Index.getCover('精准防控')
				if (res.data.list.length) {
					this.img = res.data.list[0].img_src
				}
				console.log('ses')
			}
		},
		async onLoad() {
			await this.init()
			if(this.userInfo.user_role == 'normal'){
				this.showList = this.navList.filter(item=>{
					return item.title == "整改上报" || item.title == "项目上报" ||item.title == "党风廉政考核排名"
				})
			}else if(this.userInfo.user_role == 'leader'){
				this.showList = this.navList.filter(item=>{
					return item.title !== "整改上报"&&item.title !== "项目上报"&&item.title !== "预警审核"
				})
			}else if(this.userInfo.user_role == 'boss'){
				this.showList = this.navList.filter(item=>{
					return item.title !== "整改上报"&&item.title !== "项目上报"
				})
			}
			console.log(this.showList)
		}
	}
</script>

<style lang="scss">
	
</style>
